<?php
declare(strict_types=1);

namespace Core\Package\ElementPlus\Component;

use JetBrains\PhpStorm\ExpectedValues;

/**
 * 按钮组件
 */
class DividerComponent extends ComponentAbstract
{
    protected string $_type = 'el-divider';
    protected array $_children = [];


    protected function defaultProps(): array
    {
        return [
            'direction' => 'horizontal'//设置分割线方向
        ];
    }

    public function __construct(
        string                                                $default,
        #[ExpectedValues(['left', 'right', 'center'])] string $position = 'left')
    {
        $this->_props['content-position'] = $position;
        $this->setDefault($default);
    }


    /**
     * 设置插槽内容
     * @param string $default
     * @return $this
     */
    public function setDefault(string $default): static
    {
        $this->_children = [$default];
        return $this;
    }
}